<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>My Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="This is my first blog.">
<meta property="og:type" content="website">
<meta property="og:title" content="My Blog">
<meta property="og:url" content="http://yoursite.com/page/6/index.html">
<meta property="og:site_name" content="My Blog">
<meta property="og:description" content="This is my first blog.">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="Alanisia">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="My Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.ico">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  
<link rel="stylesheet" href="/css/style.css">

<meta name="generator" content="Hexo 4.2.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">My Blog</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">我的博客 -- 记录编程过程中所遇到的问题与总结</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-chokidar-ENOSPC" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/chokidar-ENOSPC/" class="article-date">
  <time datetime="2020-09-12T13:37:58.000Z" itemprop="datePublished">2020-09-12</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/chokidar-ENOSPC/">ENOSPC错误</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>今日启动vue时，报如下错误：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;buildin): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;buildin&#x2F;harmony-module.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;buildin): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;buildin&#x2F;module.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;buildin): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;buildin&#x2F;system.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;dev-server.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;emitter.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;log-apply-result.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;log.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;only-dev-server.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;poll.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;node_modules&#x2F;webpack&#x2F;hot&#x2F;signal.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;src): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;src&#x2F;App.vue&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;src): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;src&#x2F;main.js&#39;</span><br><span class="line">Error from chokidar (&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;src&#x2F;components&#x2F;user): Error: ENOSPC: System limit for number of file watchers reached, watch &#39;&#x2F;home&#x2F;alanisia&#x2F;Projects&#x2F;a-quora&#x2F;a-quora-frontend&#x2F;src&#x2F;components&#x2F;user&#x2F;login.vue&#39;</span><br><span class="line">...</span><br></pre></td></tr></table></figure>

<p>查看报错信息：<code>ENOSPC: System limit for number of file watchers reached</code></p>
<p>当前问题主要是因为chokidar的watch需要监听很多文件的改动，但是fedora、ubuntu系统的文件句柄其实是有限制的，超出监听的文件限制而报错。</p>
<h2 id="解决方案"><a href="#解决方案" class="headerlink" title="解决方案"></a>解决方案</h2><p>通过命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ cat /proc/sys/fs/inotify/max_user_watches</span><br></pre></td></tr></table></figure>

<p>得到的结果是<code>8192</code>，执行以下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">echo</span> fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf &amp;&amp; sudo sysctl -p</span><br></pre></td></tr></table></figure>

<p>输出如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">fs.inotify.max_user_watches&#x3D;524288</span><br><span class="line">fs.inotify.max_user_watches &#x3D; 524288</span><br><span class="line">fs.inotify.max_user_watches &#x3D; 524288</span><br></pre></td></tr></table></figure>

<p>再次执行<code>cat /proc/sys/fs/inotify/max_user_watches</code>后得到的结果是<code>524288</code>，之后再次运行<code>yarn serve</code>启动vue就不会报错了。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/chokidar-ENOSPC/" data-id="ckpb8zvje0005dsvl0ioa7v38" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vue/" rel="tag">vue</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-java-string" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/java-string/" class="article-date">
  <time datetime="2020-08-08T14:33:47.000Z" itemprop="datePublished">2020-08-08</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/java-string/">Java的String、StringBuffer、StringBuilder类区别</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <ul>
<li><p>String</p>
<p>不可变对象，如果对String类对象进行修改时，会生成新的引用，新字符串与旧字符串的引用不一样。这会导致性能降低，因为生成了新的引用，GC在回收对象时需要占用更多的时间。</p>
</li>
<li><p>StringBuffer</p>
<p>可变对象，线程安全。对StringBuffer对象进行修改时，不改变引用指向。</p>
</li>
<li><p>StringBuilder(Java &gt; 1.5)</p>
<p>可变对象，线程不安全。API基本与StringBuffer一样，与StringBuffer的区别在于线程安全性。在不考虑线程安全性的情况下，推荐优先使用该类。性能方面比StringBuffer高。</p>
</li>
</ul>
<p>关于线程安全，请参阅另一篇博客：<a href="/java-safety-of-thread">JAVA线程安全</a>。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/java-string/" data-id="ckpb8zvjv000zdsvl1d77f358" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/java/" rel="tag">java</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-synchronized" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/synchronized/" class="article-date">
  <time datetime="2020-07-06T17:30:27.000Z" itemprop="datePublished">2020-07-06</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/synchronized/">线程安全</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <ul>
<li>线程安全，就是多线程访问时，采用了加锁机制，当一个线程访问该类的某个数据时进行保护，其他线程不能进行访问直到该线程读取完，其他线程才可使用。不会出现数据不一致或数据污染。</li>
<li>线程不安全，就是不提供数据访问保护，有可能出现多个线程先后更改数据造成所得到的数据是脏数据。</li>
</ul>
<p>以上概念摘抄自博客文章<a href="https://blog.csdn.net/ghevinn/article/details/37764791" target="_blank" rel="noopener">https://blog.csdn.net/ghevinn/article/details/37764791</a>。</p>
<p>如果代码在多线程环境下运行得到的数据结果和在单线程运行得到的数据结果是一样的，即没有二义性，则可以看作是线程安全；否则就是线程不安全，需要考虑同步的问题。</p>
<p>线程安全问题一般由全局变量或静态变量引起。若该全局变量或静态变量没有写权限只有读权限，那么该变量是线程安全的，否则应该考虑线程安全的问题，在修改这些变量的时候，涉及修改变量的方法应该加上synchronized关键字给方法上同步锁。</p>
<h3 id="synchronized"><a href="#synchronized" class="headerlink" title="synchronized"></a>synchronized</h3><p>以下文字摘抄自博客文章<a href="https://www.jianshu.com/p/d53bf830fa09" target="_blank" rel="noopener">https://www.jianshu.com/p/d53bf830fa09</a>。</p>
<p>关键字synchronized具有使每个线程依次排队共享变量的功能。在java代码中，synchronized可使用在代码块和方法中，根据synchronized用的位置可以有这些使用场景：</p>
<table>
<thead>
<tr>
<th align="center">分类</th>
<th align="center">具体分类</th>
<th align="center">被锁对象</th>
<th align="center">伪代码</th>
</tr>
</thead>
<tbody><tr>
<td align="center">方法</td>
<td align="center">实例方法</td>
<td align="center">类实例对象</td>
<td align="center"><code>public synchronized void method() { ... }</code></td>
</tr>
<tr>
<td align="center">方法</td>
<td align="center">静态方法</td>
<td align="center">类对象</td>
<td align="center"><code>public static synchronized void method() { ... }</code></td>
</tr>
<tr>
<td align="center">代码块</td>
<td align="center">实例对象</td>
<td align="center">类实例对象</td>
<td align="center"><code>synchronized (this) { ... }</code></td>
</tr>
<tr>
<td align="center">代码块</td>
<td align="center">class对象</td>
<td align="center">类对象</td>
<td align="center"><code>synchronized (Demo.class) { ... }</code></td>
</tr>
<tr>
<td align="center">代码块</td>
<td align="center">任意实例对象Object</td>
<td align="center">实例对象Object</td>
<td align="center"><code>String lock = &quot;&quot;; synchronized (lock) { ... }</code></td>
</tr>
</tbody></table>
<p>synchronized可以用在<strong>方法</strong>上也可以使用在<strong>代码块</strong>中，其中方法是实例方法和静态方法分别锁的是该类的实例对象和该类的对象。而使用在代码块中也可以分为三种，具体的可以看上面的表格。这里的需要注意的是：<strong>如果锁的是类对象的话，尽管new多个实例对象，但他们仍然是属于同一个类依然会被锁住，即线程之间保证同步关系</strong>。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/synchronized/" data-id="ckpb8zvkl0027dsvl31144b8u" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/java/" rel="tag">java</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-zig" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/zig/" class="article-date">
  <time datetime="2020-06-24T15:38:24.000Z" itemprop="datePublished">2020-06-24</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/zig/">Ziglang</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><p>去官网下载二进制安装包，解压即可。</p>
<h4 id="zig-vim"><a href="#zig-vim" class="headerlink" title="zig.vim"></a>zig.vim</h4><p>打开<code>.vimrc</code>，如若使用vim-plug作为插件管理器，则写入如下代码：</p>
<figure class="highlight vbscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">call</span> plug#begin(<span class="comment">'~/.vim/plugged')</span></span><br><span class="line">Plug <span class="comment">'ziglang/zig.vim'</span></span><br><span class="line"><span class="string">"Other plugins</span></span><br><span class="line"><span class="string">call plug#end()</span></span><br></pre></td></tr></table></figure>

<p>打开Vim执行安装命令： <code>:PlugInstall</code>。</p>
<h2 id="配置LSP-Vim"><a href="#配置LSP-Vim" class="headerlink" title="配置LSP(Vim)"></a>配置LSP(Vim)</h2><p>从Github上的ZLS仓库下载源码，用zig最新的master编译器编译。</p>
<p>使用coc.nvim插件管理LS，在Vim中键入命令<code>:CocConfig</code>，在打开的文件中键入如下代码：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">    <span class="attr">"languageserver"</span>: &#123;</span><br><span class="line">        <span class="attr">"zls"</span> : &#123;</span><br><span class="line">          	<span class="attr">"command"</span>: <span class="string">"/home/alanisia/Programs/zls/zig-cache/bin/zls"</span>,</span><br><span class="line">        	<span class="attr">"filetypes"</span>: [<span class="string">"zig"</span>]</span><br><span class="line">        &#125;,</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="新建项目"><a href="#新建项目" class="headerlink" title="新建项目"></a>新建项目</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">zig init-exe &lt;project-name&gt;</span><br></pre></td></tr></table></figure>

<p>这将生成一个包含<code>build.zig</code>文件和<code>src/main.zig</code>文件的项目目录。</p>
<h2 id="编译-运行-构建-测试"><a href="#编译-运行-构建-测试" class="headerlink" title="编译/运行/构建/测试"></a>编译/运行/构建/测试</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">zig build-exe &lt;zig-file&gt; <span class="comment"># 编译Zig源文件</span></span><br><span class="line">zig run &lt;zig-file&gt; <span class="comment"># 运行Zig源文件</span></span><br><span class="line">zig <span class="built_in">test</span> &lt;zig-file&gt; <span class="comment"># 执行Zig源文件中的测试(test代码块)</span></span><br><span class="line">zig build <span class="comment"># 读取当前目录的build.zig，构建项目</span></span><br></pre></td></tr></table></figure>

<h3 id="build-zig文件示例"><a href="#build-zig文件示例" class="headerlink" title="build.zig文件示例"></a>build.zig文件示例</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">const Builder &#x3D; @import(&quot;std&quot;).build.Builder;</span><br><span class="line"></span><br><span class="line">pub fn build(b: *Builder) void &#123;</span><br><span class="line">    &#x2F;&#x2F; Standard target options allows the person running &#96;zig build&#96; to choose</span><br><span class="line">    &#x2F;&#x2F; what target to build for. Here we do not override the defaults, which</span><br><span class="line">    &#x2F;&#x2F; means any target is allowed, and the default is native. Other options</span><br><span class="line">    &#x2F;&#x2F; for restricting supported target set are available.</span><br><span class="line">    const target &#x3D; b.standardTargetOptions(.&#123;&#125;);</span><br><span class="line"></span><br><span class="line">    &#x2F;&#x2F; Standard release options allow the person running &#96;zig build&#96; to select</span><br><span class="line">    &#x2F;&#x2F; between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.</span><br><span class="line">    const mode &#x3D; b.standardReleaseOptions();</span><br><span class="line"></span><br><span class="line">    const exe &#x3D; b.addExecutable(&quot;game&quot;, &quot;src&#x2F;main.zig&quot;);</span><br><span class="line">    exe.setTarget(target);</span><br><span class="line">    exe.setBuildMode(mode);</span><br><span class="line">    exe.linkLibC(); &#x2F;&#x2F; -lc</span><br><span class="line">    exe.linkSystemLibrary(&quot;ncurses&quot;); &#x2F;&#x2F; -lncurses</span><br><span class="line">    exe.install();</span><br><span class="line"></span><br><span class="line">    const run_cmd &#x3D; exe.run();</span><br><span class="line">    run_cmd.step.dependOn(b.getInstallStep());</span><br><span class="line">    if (b.args) |args| &#123;</span><br><span class="line">        run_cmd.addArgs(args);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    const run_step &#x3D; b.step(&quot;run&quot;, &quot;Run the app&quot;);</span><br><span class="line">    run_step.dependOn(&amp;run_cmd.step);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="相关网站"><a href="#相关网站" class="headerlink" title="相关网站"></a>相关网站</h2><ul>
<li>官网：<a href="https://ziglang.org" target="_blank" rel="noopener">https://ziglang.org</a></li>
<li>Github：<a href="https://github.com/ziglang/zig" target="_blank" rel="noopener">https://github.com/ziglang/zig</a></li>
<li>ziglearn：<a href="https://ziglearn.org" target="_blank" rel="noopener">https://ziglearn.org</a></li>
<li>zls：<a href="https://github.com/zigtools/zls" target="_blank" rel="noopener">https://github.com/zigtools/zls</a></li>
<li>zig.vim：<a href="https://github.com/ziglang/zig.vim" target="_blank" rel="noopener">https://github.com/ziglang/zig.vim</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/zig/" data-id="ckpb8zvlk003kdsvlaz3v9cnx" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/zig/" rel="tag">zig</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-wireshark" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/wireshark/" class="article-date">
  <time datetime="2020-06-24T15:22:11.000Z" itemprop="datePublished">2020-06-24</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/wireshark/">wireshark</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>本文所述的操作环境：Lubuntu 18.04 LTS OS</p>
<h2 id="wireshark-permission-denied解决"><a href="#wireshark-permission-denied解决" class="headerlink" title="wireshark permission denied解决"></a>wireshark permission denied解决</h2><p>输入以下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo groupadd wireshark</span><br><span class="line">sudo chgrp wireshark /usr/bin/dumpcap</span><br><span class="line">sudo chmod 4755 /usr/bin/dumpcap</span><br><span class="line">sudo gpasswd -a alanisia wireshark</span><br></pre></td></tr></table></figure>

<h2 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h2><p>点击正在上网的网卡，软件会进入抓包界面。点击启动按钮，软件开始抓包；点击停止按钮，软件停止抓包。可以在过滤器栏里输入过滤条件，筛选出特定的数据包。</p>
<p>TODO</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/wireshark/" data-id="ckpb8zvl5003adsvl4fi76qp9" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/" rel="tag">network</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    
    <a class="extend prev" rel="prev" href="/page/5/">&amp;laquo; 上一页</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/4/">4</a><a class="page-number" href="/page/5/">5</a><span class="page-number current">6</span><a class="page-number" href="/page/7/">7</a><a class="page-number" href="/page/8/">8</a><span class="space">&hellip;</span><a class="page-number" href="/page/13/">13</a><a class="extend next" rel="next" href="/page/7/">下一页 &amp;raquo;</a>
  </nav>

</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/" rel="tag">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/data-structure/" rel="tag">data structure</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/" rel="tag">docker</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/" rel="tag">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/go/" rel="tag">go</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/" rel="tag">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/" rel="tag">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/" rel="tag">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/" rel="tag">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/" rel="tag">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maven/" rel="tag">maven</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mybatis/" rel="tag">mybatis</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mysql/" rel="tag">mysql</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/" rel="tag">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/" rel="tag">nginx</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nodejs/" rel="tag">nodejs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/searching/" rel="tag">searching</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sorting/" rel="tag">sorting</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sublime-text/" rel="tag">sublime text</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/termux/" rel="tag">termux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/theia/" rel="tag">theia</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/typora/" rel="tag">typora</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vala/" rel="tag">vala</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/" rel="tag">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vue/" rel="tag">vue</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zig/" rel="tag">zig</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zookeeper/" rel="tag">zookeeper</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/data-structure/" style="font-size: 10px;">data structure</a> <a href="/tags/docker/" style="font-size: 10px;">docker</a> <a href="/tags/git/" style="font-size: 15px;">git</a> <a href="/tags/go/" style="font-size: 10px;">go</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/java/" style="font-size: 18.33px;">java</a> <a href="/tags/javascript/" style="font-size: 11.67px;">javascript</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/linux/" style="font-size: 20px;">linux</a> <a href="/tags/maven/" style="font-size: 10px;">maven</a> <a href="/tags/mybatis/" style="font-size: 10px;">mybatis</a> <a href="/tags/mysql/" style="font-size: 11.67px;">mysql</a> <a href="/tags/network/" style="font-size: 11.67px;">network</a> <a href="/tags/nginx/" style="font-size: 10px;">nginx</a> <a href="/tags/nodejs/" style="font-size: 13.33px;">nodejs</a> <a href="/tags/searching/" style="font-size: 10px;">searching</a> <a href="/tags/sorting/" style="font-size: 16.67px;">sorting</a> <a href="/tags/sublime-text/" style="font-size: 10px;">sublime text</a> <a href="/tags/termux/" style="font-size: 10px;">termux</a> <a href="/tags/theia/" style="font-size: 10px;">theia</a> <a href="/tags/typora/" style="font-size: 10px;">typora</a> <a href="/tags/vala/" style="font-size: 10px;">vala</a> <a href="/tags/vim/" style="font-size: 15px;">vim</a> <a href="/tags/vue/" style="font-size: 11.67px;">vue</a> <a href="/tags/zig/" style="font-size: 10px;">zig</a> <a href="/tags/zookeeper/" style="font-size: 10px;">zookeeper</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/05/">五月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/04/">四月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/03/">三月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/01/">一月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/11/">十一月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/10/">十月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/09/">九月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/08/">八月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/07/">七月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/06/">六月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/05/">五月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/03/">三月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/02/">二月 2020</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/java-hashmap/">java.util.HashMap</a>
          </li>
        
          <li>
            <a href="/jvm/">JVM</a>
          </li>
        
          <li>
            <a href="/java-locks/">Java锁</a>
          </li>
        
          <li>
            <a href="/java-references/">Java引用</a>
          </li>
        
          <li>
            <a href="/gitea/">Gitea</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2021 Alanisia<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">

  
<script src="/fancybox/jquery.fancybox.pack.js"></script>




<script src="/js/script.js"></script>




  </div>
</body>
</html>